<template>
	<div class="flex-c-c-c">
		<div style="height: 500px;width: 100%;" class="flex-c-c-c imgs_back"
			:style="{ backgroundImage:'url('+back_img.img+')'}">
			<span style="font-size: 30px;color: #FFF;" v-if="type==1">{{obj.createdate}}</span>
			<div :style="{borderTop:type==1?'1px solid #FFF':'0px solid #FFF'}"
				style="font-size: 60px;color: #FFF;height: 100px;line-height: 100px;margin-top: 15px;font-weight: 250;">
				{{type==1?obj.intro:back_img.intro}}
			</div>
		</div>
		<div class="flex_divs flex-c-c-c">
			<span style="font-size: 40px;color: #907A6E;">
				{{type==1?'动态详情':obj.title}}
			</span>
			<span style="font-size:30px;color: #907A6E;margin-top: 30px;" v-if="type==1">
				{{obj.createdate}}
			</span>
			<div class="html_divs" style="margin-top: 30px;">
				<div v-html="obj.content">
				</div>
			</div>
			<!-- <div class="flex-r-b-c" style="margin: 30px 0;">
				<div class="flex-r-b-c" style="width: 50%;">
					<img :src="obj.img_one" style="width: 100%;height: 360px;">
				</div>
				<div class="flex-c-b-s" style="width: 47%;">
					<span style="font-size:24px;color: #907A6E;"> 总部地址：{{obj.address}}</span>
					<span style="font-size:24px;color: #907A6E;margin-top: 60px;">咨询电话：{{obj.phone}}</span>
				</div>
			</div>
			<div class="flex-r-b-c" style="margin: 30px 0;">
				<div class="flex-c-b-s" style="width: 47%;">
					<span style="font-size:24px;color: #907A6E;">企业邮箱：{{obj.email}}</span>
				</div>
				<div class="flex-r-b-c" style="width: 50%;">
					<img :src="obj.img_two" style="width: 100%;height: 360px;">
				</div>
			</div> -->
		</div>
	</div>
</template>

<script>
	import {
		formatDate
	} from '../components/datas.js'
	import {
		Message
	} from 'element-ui';
	export default {
		data() {
			return {
				back_img: {},
				obj: {},
				type: null
			}
		},
		mounted() {
			console.log(this.$route.query)
			let route_obj = {
				id: this.$route.query.id,
				type: this.$route.query.type
			}
			this.type = route_obj.type
			let headers = {
				token: this.$md5(this.$key + this.$dataTime()),
				rtimes: this.$dataTime(),
				id: route_obj.id
			}
			let path = route_obj.type == 1 ? '/News/newsDetails' : '/Announcement/annDetails'
			this.$axios.post(this.$base + path, headers).then((res) => {
					if (res.data.code == 2000) {
						this.obj = res.data.data
						document.title = route_obj.type == 1 ?`新闻-${res.data.data.title}`:`公告-${res.data.data.title}`
					} else {
						Message.error(res.data.msg);
					}
					console.log(res)
				})
				.catch(function(error) {
					Message.error(error.message);
				});
			headers.btype = route_obj.type == 1 ? 'news' : 'ann'
			this.$axios.post(this.$base + '/Index/getBg', headers).then((res) => {
					if (res.data.code == 2000) {
						this.back_img = res.data.data
					} else {
						Message.error(res.data.msg);
					}
					console.log(res)
				})
				.catch(function(error) {
					Message.error(error.message);
				});
		},
		methods: {
			data_fn(time, ges) {
				return formatDate(new Date(Number(time)), ges)
			},
		}
	}
</script>

<style scoped>
	.imgs_back {
		background-position: center top;
		background-repeat: no-repeat;
		background-attachment: scroll;
		background-size: 1920px 500px;
		background-origin: border-box;
	}

	.flex_divs {
		width: 65%;
		height: auto;
		padding: 50px;
		margin: 70px 0;
		box-shadow: 0px 3px 9px #00000026;
		background-color: #FFF;
	}
</style>
